package cn.lyjuan.payment.third.base.model.utils;

import java.io.File;

/**
 * @author arvin
 * desc payment-third cn.lyjuan.payment.third.base.model.utils
 * 2021/3/10 14:16
 */
public class FilePrefixUtil {

    /**
     * 获取证书路径
     *
     * @param path path
     * @return String
     */
    public static String getPrefixPath(String path) {
        File file = new File(path);
        if (file.isAbsolute()) {
            return file.getAbsolutePath() + "/";
        }
        String clsPath = FilePrefixUtil.class.getClassLoader().getResource("./").getPath();
        String str = clsPath.replace("test-classes", "classes") + path;
        if (path.endsWith("/")) {
            return str;
        }
        return str + "/";
    }
}
